package com.eorchis.module.trainingneeds.ui.commond;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.beanutils.BeanUtils;
import org.codehaus.jackson.map.ObjectMapper;

import com.eorchis.core.page.commond.SortInfoBean;
import com.eorchis.core.ui.commond.IQueryCommond;
import com.eorchis.core.ui.commond.impl.BasePageQueryCommond;
/**
 * Title: QuestionnaireSurveyObjectQueryCommond<br>
 * Description: 问卷调查对象queryCommond<br>
 * Company: GoldGov<br>
 * Copyright @ 2012 GoldGov .All rights reserved.<br>
 * @author HuangTF
 * @createDate 2014-02-07
 * @version $Revision$
 */
public class QuestionnaireSurveyObjectQueryCommond extends BasePageQueryCommond implements IQueryCommond
{
	private String[] questionnaireSurveyObjectIds;//问卷调查对象主键Ids
	private String questionnaireId;//问卷id
	private String treePath;//单位路径
	private String userName;//学员姓名
	private String loginId;//登陆id
	private String depName;//单位名称
	private String depId;//单位id
	private String rankCode;//职级
	private String[] surveyObjectIds;//调查对象ID集合
	private Integer surveyObjectType;//调查对象类型   1：全体   2：指定人员
	
	public String[] getQuestionnaireSurveyObjectIds() {
		return questionnaireSurveyObjectIds;
	}
	public void setQuestionnaireSurveyObjectIds(
			String[] questionnaireSurveyObjectIds) {
		this.questionnaireSurveyObjectIds = questionnaireSurveyObjectIds;
	}
	public Integer getSurveyObjectType() {
		return surveyObjectType;
	}
	public void setSurveyObjectType(Integer surveyObjectType) {
		this.surveyObjectType = surveyObjectType;
	}
	public String getQuestionnaireId() {
		return questionnaireId;
	}
	public void setQuestionnaireId(String questionnaireId) {
		this.questionnaireId = questionnaireId;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getLoginId() {
		return loginId;
	}
	public void setLoginId(String loginId) {
		this.loginId = loginId;
	}
	public String getDepName() {
		return depName;
	}
	public void setDepName(String depName) {
		this.depName = depName;
	}
	public String getDepId() {
		return depId;
	}
	public void setDepId(String depId) {
		this.depId = depId;
	}
	public String getRankCode() {
		return rankCode;
	}
	public void setRankCode(String rankCode) {
		this.rankCode = rankCode;
	}
	public String getTreePath() {
		return treePath;
	}
	public void setTreePath(String treePath) {
		this.treePath = treePath;
	}
	public String[] getSurveyObjectIds() {
		return surveyObjectIds;
	}
	public void setSurveyObjectIds(String[] surveyObjectIds) {
		this.surveyObjectIds = surveyObjectIds;
	}

	/**
	 * EXT 页面排序
	 */
	private SortInfoBean sortInfo = null;
	
	/**
	 * 获取排序内容
	 * 
	 * @return
	 * @author HuangS
	 * @date Jul 20, 2012
	 */
	public SortInfoBean getSortInfos() {
		return this.sortInfo;
	}

	/**
	 * 设置排序内容
	 * 
	 * @param sort
	 * @author HuangS
	 * @date Jul 25, 2012
	 */
	@SuppressWarnings("unchecked")
	public void setSort(String sort) {
		if (sort != null && !"".equals(sort)) {
			sortInfo = new SortInfoBean();
			ObjectMapper objectMapper = new ObjectMapper();
			try {
				List<LinkedHashMap<String, Object>> list = objectMapper.readValue(sort, List.class);
				for (int i = 0; i < list.size(); i++) {
					Map<String, Object> map = list.get(i);
					Set<String> set = map.keySet();
					for (Iterator<String> it = set.iterator(); it.hasNext();) {
						String key = it.next();
						BeanUtils.setProperty(sortInfo, key, map.get(key));
					}
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
	
}
